<HTML> 
<HEAD> 
	<TITLE>3rd Party ROBOTC Drivers</TITLE> 
<link href="tabs.css" rel="stylesheet" type="text/css"/> 
<link href="doxygen.css" rel="stylesheet" type="text/css"/> 
</HEAD> 
 
<BODY bgcolor="#ffffff" link="#000000" vlink="#000000"> 
<table width="100%" bgcolor="navy" cellspacing=0 cellpadding=1 border=0> 
<tr><td><table width="100%" bgcolor="#EEEEDD" cellspacing=0 cellpadding=3 border=0> 
<tr> 
    <td width="33%" align="left"> <img src="images/LOGO_NXT.gif" width=266 height=44 border="0" alt="Mindstorms"></td> 
    <td><b><font size="+3" color="navy">3rd Party ROBOTC Drivers</font></b></td> 
    <td align="right"> <img src="images/logo.png" width=44 height=44 border="0" alt="RobotC"></td>     
</tr> 
  <tr bgcolor="#cccc99" align="right"> 
          <td colspan=3> <font face="arial" size="-1"> [<a href=main.html>Home</a>] [<a target=_top href="https://sourceforge.net/projects/rdpartyrobotcdr/">Download</a>] [<a target=_top href="http://apps.sourceforge.net/mantisbt/rdpartyrobotcdr/my_view_page.php">Submit a bug/suggestion</a>]  [<a target=_top href="http://www.robotc.net/forums/">ROBOTC Forums</a>] [<a target=_top href="http://botbench.com">Blog</a>] [<a target=_top href="http://sourceforge.net/donate/index.php?group_id=257238">Support this project</a>]</font> </td> 
</tr> 
</table></td></tr> 
</table> 
<!-- Generated by Doxygen 1.7.2 -->
<div class="header">
  <div class="headertitle">
<h1>mindsensors-hid-test1.c</h1>  </div>
</div>
<div class="contents">
<div class="fragment"><pre class="fragment"><span class="preprocessor">#pragma config(Sensor, S1,     MSHID,               sensorI2CCustom9V)</span>
<span class="preprocessor"></span><span class="comment">//*!!Code automatically generated by &#39;ROBOTC&#39; configuration wizard               !!*//</span>

<span class="comment">/*</span>
<span class="comment"> * $Id: mindsensors-hid-test1.c 133 2013-03-10 15:15:38Z xander $</span>
<span class="comment"> */</span>
<span class="comment"></span>
<span class="comment">/**</span>
<span class="comment"> * mindsensors-hid.h provides an API for the Mindsensors HID Sensor.  This program</span>
<span class="comment"> * demonstrates how to use that API.</span>
<span class="comment"> *</span>
<span class="comment"> * Changelog:</span>
<span class="comment"> * - 0.1: Initial release</span>
<span class="comment"> * - 0.2: More comments</span>
<span class="comment"> *</span>
<span class="comment"> * Credits:</span>
<span class="comment"> * - Big thanks to Mindsensors for providing me with the hardware necessary to write and test this.</span>
<span class="comment"> *</span>
<span class="comment"> * License: You may use this code as you wish, provided you give credit where it&#39;s due.</span>
<span class="comment"> *</span>
<span class="comment"> * THIS CODE WILL ONLY WORK WITH ROBOTC VERSION 3.59 AND HIGHER. </span>
<span class="comment"></span>
<span class="comment"> * Xander Soldaat (xander_at_botbench.com)</span>
<span class="comment"> * 28 November 2009</span>
<span class="comment"> * version 0.2</span>
<span class="comment"> */</span>

<span class="preprocessor">#include &quot;<a class="code" href="mindsensors-hid_8h.html" title="Mindsensors HID Sensor driver.">drivers/mindsensors-hid.h</a>&quot;</span>

task main () {
  <span class="comment">//                      |</span>
  <span class="comment">//             1234567890123456789</span>
  <span class="keywordtype">string</span> msg1 = <span class="stringliteral">&quot;notepad\r\n&quot;</span>;
  <span class="keywordtype">string</span> msg2 = <span class="stringliteral">&quot;hello world&quot;</span>;

  <span class="comment">// Tell the MSHID you are going to send raw keyboard data</span>
  <a name="a0"></a><a class="code" href="group__mshid.html#ga2d3259d4adcae2db488e16f094901ec3">MSHIDsendCommand</a>(MSHID, <a name="a1"></a><a class="code" href="group__mshid.html#ga25e63521abc54eaca70c7b94204b62a6">MSHID_DDATA</a>);

  <span class="comment">// The raw keyboard data (Windows Key + R)</span>
  <a name="a2"></a><a class="code" href="group__mshid.html#gab08f31e26bb6385ceb436170f2e30acf">MSHIDsendKeyboardData</a>(MSHID, <a name="a3"></a><a class="code" href="group__mshid.html#ga9c4acbf791c14947efc7a1cadddee71e">MSHID_MOD_LGUI</a>, 0x15);
<span class="comment"></span>
<span class="comment">  /// Transmit the data</span>
<span class="comment"></span>  <a class="code" href="group__mshid.html#ga2d3259d4adcae2db488e16f094901ec3">MSHIDsendCommand</a>(MSHID, <a name="a4"></a><a class="code" href="group__mshid.html#gaf515c73ab7fbc1b10d63e029cc007618">MSHID_XMIT</a>);

  <span class="comment">// Wait the command box to appear</span>
  wait1Msec(1000);

  <span class="comment">// Set the MSHID to normal ACSII mode</span>
  <a class="code" href="group__mshid.html#ga2d3259d4adcae2db488e16f094901ec3">MSHIDsendCommand</a>(MSHID, <a name="a5"></a><a class="code" href="group__mshid.html#gad9585939709a8e02e0ba82b1d560fb7e">MSHID_ASCII</a>);

  <span class="comment">// Send the first command: &quot;notepad&quot; followed by \r\n (enter)</span>
  <a name="a6"></a><a class="code" href="group__mshid.html#gae9af2d42a0ab943ac86d33d8fa2d7a54">MSHIDsendString</a>(MSHID, msg1);

  <span class="comment">// Wait for notepad to start up</span>
  wait1Msec(2000);

  <span class="comment">// Send the second message &quot;hello world&quot;</span>
  <a class="code" href="group__mshid.html#gae9af2d42a0ab943ac86d33d8fa2d7a54">MSHIDsendString</a>(MSHID, msg2);
}
</pre></div> </div>
</div>
<hr class="footer"/><address class="footer"><small>Generated on Wed Mar 13 2013 19:56:42 for ROBOTC Drivers by&#160;
<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.7.2 </small></address>
</body>
</html>
